import request from '@/utils/request'

// 查询药品库存列表
export function listStock(query) {
  return request({
    url: '/drug/stock/list',
    method: 'get',
    params: query
  })
}

//预警药品库存列表
export function alertlistStock(query) {
  return request({
    url: '/drug/stock/listWarn',
    method: 'get',
    params: query
  })
}

// 查询药品库存详细
export function getStock(code) {
  return request({
    url: '/drug/stock/' + code,
    method: 'get'
  })
}

// 新增药品库存
export function addStock(data) {
  return request({
    url: '/drug/stock',
    method: 'post',
    data: data
  })
}

// 修改药品库存
export function updateStock(data) {
  return request({
    url: '/drug/stock',
    method: 'put',
    data: data
  })
}

// 删除药品库存
export function delStock(code) {
  return request({
    url: '/drug/stock/' + code,
    method: 'delete'
  })
}

//药品入库
export function stockIn(data) {
  return request({
    url: '/drug/stock/in',
    method: 'post',
    data: data
  })
}

//药品出库
export function stockOut(data) {
  return request({
    url: '/drug/stock/out',
    method: 'post',
    data: data
  })
}

//根据关键字查询药品库存
export function getDrugs(keyword) {
  return request({
    url: '/drug/stock/listByKey',
    method: 'get',
    params: {keyword}
  })
}

//发药更新库存
export function dispenseMedicines(data) {
  return request({
    url: '/drug/stock/dispenseMedicines',
    method: 'post',
    data: data
  })
}